/*
 * Copyright (c) 2022, tyustli
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-02-08     tyustli      first implementation
 */

#include <stdio.h>
#include <math.h>

int oc2dec(int value)
{
    int i = 0;
    int sum = 0;

    while (value != 0)
    {
        sum += (value % 10) * pow(8, i);
        i++;
        value /= 10;
    }

    return sum;
}

int main(int argc, char **argv)
{
    printf("%d to dec is %d\r\n", 78, oc2dec(78));
    printf("%d to dec is %d\r\n", 116, oc2dec(116));


    return 1;
}

/******************** end of file **********************/
